﻿using System;

class HexadecimalToBinary
{
    static void Main()
    {
        //Exercise 5.
        //Write a program to convert hexadecimal numbers to binary numbers (directly).

        //For example: FE -> 11111110;  1F4 -> 000111110100

        Console.Write("Enter a hexadecimal number: ");
        string numberHexa = Console.ReadLine();        
        string numberBin = "";

        for (int i = 0; i < numberHexa.Length; i++)
        {
            switch (numberHexa.Substring(i, 1))
            {
                case "0": 
                    numberBin += "0000"; 
                    break;
                case "1": 
                    numberBin += "0001"; 
                    break;
                case "2": 
                    numberBin += "0010"; 
                    break;
                case "3": 
                    numberBin += "0011"; 
                    break;
                case "4": 
                    numberBin += "0100"; 
                    break;
                case "5": 
                    numberBin += "0101"; 
                    break;
                case "6": 
                    numberBin += "0110"; 
                    break;
                case "7": 
                    numberBin += "0111"; 
                    break;
                case "8": 
                    numberBin += "1000"; 
                    break;
                case "9": 
                    numberBin += "1001"; 
                    break;
                case "A": 
                    numberBin += "1010"; 
                    break;
                case "B": 
                    numberBin += "1011"; 
                    break;
                case "C": 
                    numberBin += "1100"; 
                    break;
                case "D": 
                    numberBin += "1101"; 
                    break;
                case "E": 
                    numberBin += "1110"; 
                    break;
                case "F": 
                    numberBin += "1111"; 
                    break;
                default: 
                    numberBin += ""; 
                    break;
            }
        }
        Console.WriteLine(numberBin);
    }
}

